# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=spraycharles
pkgver=239.95699b8
_pyver=3.13
pkgrel=1
pkgdesc='Low and slow password spraying tool, designed to spray on an interval over a long period of time.'
groups=('blackarch' 'blackarch-cracker')
arch=('any')
url='https://github.com/Tw1sm/spraycharles'
license=('BSD')
depends=('python' 'impacket' 'python-numpy' 'python-requests' 'python-texttable'
         'python-requests-ntlm' 'python-pymsteams' 'python-click-config-file'
         'python-rich' 'python-discord-webhook' 'python-notifiers')
makedepends=('git' 'python-pip' 'python-build')
source=("git+https://github.com/Tw1sm/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/doc/$pkgname/"
  install -dm 755 "$pkgdir/usr/share/licenses/$pkgname/"

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    "$pkgname"

  mv "$pkgdir/usr/lib/python$_pyver/site-packages/CHANGELOG.md" \
    "$pkgdir/usr/share/doc/$pkgname/CHANGELOG.md"

  mv "$pkgdir/usr/lib/python$_pyver/site-packages/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

